package com.liu.manager.mapper;

import com.liu.manager.entity.UserAndRoler;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserAndRolerMapper {

    @Insert("insert into user_roler(user_id,roler_id,create_time) values(#{userId},#{rolerId},#{createTime})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    int insertUserAndRoler(UserAndRoler userAndRoler);
    @Delete("delete from user_roler where id=#{id}")
    int deleteUserAndRoler(long id);
    @Select("select * from user_roler where id=#{id}")
    UserAndRoler findById(long id);

    @Select("select * from user_roler where user_id=#{userId}")
    List<UserAndRoler> findByUserId(long userId);

    @Select("select * from user_roler where roler_id=#{rolerId}")
    List<UserAndRoler> findByRolerId(long rolerId);
}
